import * as XLSX from 'xlsx';

export default (data: any, tableName: string, SheetName: string) => {
    data = data.map((e: any) => Object.values(e)) as any;
    let filename = tableName + '.xlsx';
    let ws_name = SheetName;
    let wb = XLSX.utils.book_new();
    let ws = XLSX.utils.aoa_to_sheet(data as any);
    XLSX.utils.book_append_sheet(wb, ws, ws_name);
    XLSX.writeFile(wb, filename);
};